$\forall$$x$:top, ${\it as}$:(top List). sqequal(last(cons($x$; ${\it as}$)); if null(${\it as}$) then $x$ else last(${\it as}$) fi )